#ifndef __FSM_MSG_H__
#define __FSM_MSG_H__

#include "stdint.h"

typedef struct fsm_msg_str {
    uint8_t *msg_pool;          // 消息池
    uint8_t  msg_sgl_size;      // 单个消息大小
    uint32_t msg_sum_cnt;       // 消息总数
    uint32_t msg_rx_cnt;        // 消息数量
    uint32_t msg_read_idx;      // 消息读取位置
    uint32_t msg_write_idx;     // 消息写入位置
} fsm_msg_t;

void fsm_msg_init(fsm_msg_t *msg_ctr, uint8_t *msg_pool, uint32_t msg_pool_size, uint8_t msg_sgl_size);
int  fsm_msg_write(fsm_msg_t *msg_ctr, uint8_t *pData, uint8_t DatLen);
int  fsm_msg_read(fsm_msg_t *msg_ctr, uint8_t *pData);

#endif
